package com.eliza.base.entity.model.user

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.eliza.library.data.entity.UserEntity
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject


class UserRepository @Inject constructor(
    private val userDao: UserDao
) {
    suspend fun getAllFlow(): Flow<List<UserEntity>> {
        return userDao.getAllFlow()
    }

    fun getAllNormal(): LiveData<List<UserEntity>> {
        return userDao.getAllNormal()
    }

    suspend fun insert(users: List<UserEntity>) {
        userDao.insert(users)
    }


    suspend fun getByName(user: String): Flow<List<UserEntity>> {
        return userDao.getByName(user)
    }

    suspend fun deleteById(user: UserEntity) {
        return userDao.deleteById(user)
    }

    suspend fun upsertUsers(entities: List<UserEntity>) {
        return userDao.upsertUsers(entities)
    }

    suspend fun getByIds(ids: Set<Int>): Flow<List<UserEntity>> {
        return userDao.getByIds(ids)
    }

    suspend fun getById(id: Int): Flow<UserEntity> {
        return userDao.getById(id)
    }

}
